#!/usr/bin/env python
# -*- coding:utf-8 -*-

# http://bbs.csdn.net/topics/392033045?page=1
# 用Tkinter 实现多选项卡

import tkinter
import tkinter.ttk

# import sys
# if sys.version_info.major == 3:  # python3
#     import tkinter
#     import tkinter.ttk
# else:  # Python2
#     from Tkinter import *
#     from tkFont import Font
#     from ttk import *
#     # Usage:showinfo/warning/error,askquestion/okcancel/yesno/retrycancel
#     from tkMessageBox import *
#     # Usage:f=tkFileDialog.askopenfilename(initialdir='E:/Python')
#     # import tkFileDialog
#     # import tkSimpleDialog


class Application_ui(tkinter.Frame):
    # 这个类仅实现界面生成功能，具体事件处理代码在子类Application中。
    def __init__(self, master=None):
        tkinter.Frame.__init__(self, master)
        self.master.title('Form1')
        self.master.geometry('389x339')
        self.createWidgets()

    def createWidgets(self):
        self.top = self.winfo_toplevel()
        self.style = tkinter.ttk.Style()

        self.TabControl = tkinter.ttk.Notebook(self.top)  # ttk.Notebook笔记本组件类似C#中的TabControl
        self.TabControl.place(relx=0.062, rely=0.071, relwidth=0.887, relheight=0.876)

        self.TabControl_Tab1 = tkinter.Frame(self.TabControl)
        self.TabControl_Tab1Lbl = tkinter.Label(self.TabControl_Tab1, text='Please add widgets in code.')
        self.TabControl_Tab1Lbl.place(relx=0.1, rely=0.5)
        self.TabControl.add(self.TabControl_Tab1, text='我的快玩')

        self.TabControl_Tab2 = tkinter.Frame(self.TabControl)
        self.TabControl_Tab2Lbl = tkinter.Label(self.TabControl_Tab2, text='Please add widgets in code.')
        self.TabControl_Tab2Lbl.place(relx=0.1, rely=0.5)
        self.TabControl.add(self.TabControl_Tab2, text='找游戏')


class Application(Application_ui):
    # 这个类实现具体的事件处理回调函数。界面生成代码在Application_ui中。
    def __init__(self, master=None):
        Application_ui.__init__(self, master)


def main():
    top = tkinter.Tk()
    Application(top).mainloop()


if __name__ == "__main__":
    main()
